package com.sc.nft.dto;

import cn.hutool.core.convert.Convert;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.NumberUtil;
import com.sc.nft.entity.DigitalCollection;
import com.sc.nft.entity.EcologyHatchShareIncomeConf;
import com.sc.nft.entity.UserCreatorInfo;
import com.sc.nft.enums.DaoInfoEnum;
import com.sc.nft.enums.EcologyHatchShareProfitSeparateAccountTypeEnum;
import com.sc.nft.enums.EcologyHatchShareProfitTypeEnum;
import com.sc.nft.exception.GlobalRunTimeException;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;

@Data
public class ADDEcologyIncomeDetailsConfDTO {


    @ApiModelProperty(value = "类型: SHARE_PROFIT:分享收益 PLATFORM_DIVIDE:平台分红池 DAO_DIVIDE:DAO分红池 RISK_POOL:风控池 TECHNICAL_SERVICE_FEE:技术服务费 BOTH_PARTIES_ACCOUNT:双方分账 MARKET_VALUE_MANAGEMENT:市值管理 PER_DIVIDEND_POOL:每份分红池")
    @NotNull(message = "分润类型不能为空")
    private EcologyHatchShareProfitTypeEnum type;

    @ApiModelProperty(value = "双方分账类型 DEFAULT_VALUE:缺省值 STATIC_SCALE:固定比例 DYNAMIC_SCALE:动态比例")
    @NotNull(message = "双方分账类型不能为空")
    private EcologyHatchShareProfitSeparateAccountTypeEnum separateAccountType;

    @ApiModelProperty(value = "藏品id集合")
    private List<Long> collectionIds;

    @ApiModelProperty(value = "品牌DaoId")
    private Long daoId;

    @ApiModelProperty(value = "平台DaoId")
    private Long platformDaoId;

    @ApiModelProperty(value = "服务中心DaoId")
    private Long serviceCenterDaoId;

    @ApiModelProperty(value = "总分配比例")
    @NotNull(message = "总分配比例不能为空")
    private BigDecimal distributionScale;

    @ApiModelProperty(value = "平台分成比例")
    private BigDecimal platformDivideScale = BigDecimal.ZERO;

    @ApiModelProperty(value = "DAO分成比例")
    private BigDecimal daoDivideIntoScale = BigDecimal.ZERO;

    @ApiModelProperty(value = "品牌拉新人数")
    private Integer daoNewUserNum;

    @ApiModelProperty(value = "服务中心拉新人数")
    private Integer serviceCenterNewUserNum;

    @ApiModelProperty(value = "共振品牌分成比例")
    private BigDecimal resonanceDaoDivideIntoScale = BigDecimal.ZERO;

    @ApiModelProperty(value = "共振服务中心dao分成比例")
    private BigDecimal resonanceServiceCenterDaoDivideIntoScale = BigDecimal.ZERO;

    public BigDecimal getDistributionScale() {
        return distributionScale.setScale(4, BigDecimal.ROUND_DOWN);
    }

    public BigDecimal getPlatformDivideScale() {
        return platformDivideScale.setScale(4, BigDecimal.ROUND_DOWN);
    }

    public BigDecimal getDaoDivideIntoScale() {
        return daoDivideIntoScale.setScale(4, BigDecimal.ROUND_DOWN);
    }

//    public BigDecimal getServiceCenterDaoDivideIntoScale() {
//        return serviceCenterDaoDivideIntoScale.setScale(4, BigDecimal.ROUND_DOWN);
//    }

    public BigDecimal getResonanceDaoDivideIntoScale() {
        return resonanceDaoDivideIntoScale.setScale(4, BigDecimal.ROUND_DOWN);
    }

    public BigDecimal getResonanceServiceCenterDaoDivideIntoScale() {
        return resonanceServiceCenterDaoDivideIntoScale.setScale(4, BigDecimal.ROUND_DOWN);
    }
}
